package com.vodone.v1pin.userInfo.delegate
{
	import com.vodone.v1pin.ServiceProvider;
	import com.vodone.v1pin.core.model.MainModelLocator;
	import com.vodone.v1pin.core.service.HttpJsonDelegate;
	
	import mx.rpc.http.mxml.HTTPService;
	
	public class UserInfoDelegate
	{
		public static function getAreaList( resultHandler:Function , id:String = "0", faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().areaService;
			var params:Object = {
				id : id
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function getUserInfo( resultHandler:Function , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getUserInfoService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function updateUserInfo( resultHandler:Function , trueName:String , sex:int , birthday:String , provinceCode:String , cityCode:String , areaCode:String , love:String , mobile:String ,  faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().updateUserInfoService;
			var params:Object = {
				userID : MainModelLocator.getInstance().userLoginVO.userId,
				trueName : trueName,
				sex : sex,
				birthday : birthday,
				provinceCode : provinceCode,
				cityCode : cityCode,
				areaCode : areaCode,
				love : love,
				mobile : mobile
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function editPwd( resultHandler:Function  , oldPwd:String , newPwd:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().editPwdService;
			var params:Object = {
				oid : MainModelLocator.getInstance().userLoginVO.oId,
				oldPwd : oldPwd,
				newPwd : newPwd
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function verifyUserMessage( resultHandler:Function , typeid:String , type:String , url:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getMailVerifyService;
			var params:Object = {
				oid : MainModelLocator.getInstance().userLoginVO.oId,
				typeid : typeid,
				type:type,
				bindUrl:url
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		public static function returnMobileMessage( resultHandler:Function , userID:String , message:String , messageCode:String , type:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().returnMobileVerifyService;
			var params:Object = {
					oid : userID,
					message : message,
					type : type,
					messageCode:messageCode
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function getPassOneStep( resultHandler:Function , typeid:String , type:String , url:String = "", faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getPassOneService;
			var params:Object = {
				type : type,
				typeid:typeid,
				findPwdUrl:url
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		public static function getPassTwoStep( resultHandler:Function , oid:String , pwd:String ,  valicode:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getPassTwoService;
			var params:Object = {
				oid : oid,
				password : pwd,
				valicode:valicode
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
		
		public static function getPassThreeStep( resultHandler:Function , oid:String , typeid:String , type:String , valicode:String , faultHandler:Function = null , context:Array = null ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getPassThreeService;
			var params:Object = {
				oid : oid,
				typeid : typeid,
				type : type,
				valicode:valicode
			}
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler , context );
		}
	}
}